<?php require_once '../model/logticket.php';?>
<?php require_once '../util/verifyMenu.php';?>
<?php require_once '../util/verifyLogin.php';?>
<?php require_once '../util/header.php';?>
<body>
<div class="mycontent" align="center">
<img src="public/img/header.png" style="width: 1024px; margin: -6px;">
<?php require_once '../util/menu.php';?>
<div align="left">
&nbsp;&nbsp;&nbsp;ยอดซื้อ <b><?php echo $_SESSION['profit'];?></b> บาท&nbsp;&nbsp;&nbsp;
<input type="button" class="btn btn-info" value="ดูประวัติการซื้อ" style="margin-right: 20px;" onclick="javascript:location.href='buydetail.php'">
<span style="float: right;">
สวัสดี คุณ <b><?php echo $_SESSION['name']." ".$_SESSION['lastname'];?></b>&nbsp;&nbsp;&nbsp;
<input type="button" class="btn" value="ออกจากระบบ" style="margin-right: 20px;" onclick="javascript:location.href='../util/logout.php'">
</span>
</div>
<hr>
<?php 
	
	$data = $_SESSION['detail'];
	echo "<div style='margin-left:10px; margin-right:10px;'>";
	echo "<table class='table table-hover'>";
	echo "<th>ลำดับ</th><th>เส้นทาง</th><th>เวลา</th><th>วันที่</th><th>ราคา</th>";
	for ($i = 0; $i < count($data); $i++) {
		$detail = preg_split("/;/", $data[$i]->detail);
		echo "<tr>";
		echo "<td>".($i+1)."</td>";
		echo "<td>$detail[0]</td>";
		echo "<td>$detail[1]</td>";
		echo "<td>$detail[2]</td>";
		echo "<td>".$data[$i]->price."</td>";
		echo "</tr>";
	}
	echo "</table></div>";
?>
<?php require_once '../util/footer.php';?>
</div>
</body>
